package com.fingard;

import com.fingard.luna.framework.boot.core.launch.LunaBootApplication;
import com.fingard.luna.framework.database.mybatis.condition.ConditionalOnDatabaseEnable;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@SpringBootConfiguration
@EnableAutoConfiguration
@EnableFeignClients("com.fingard.dsp.api.manager")
@ComponentScan("com.fingard.dsp")
public class DspApplication {

    @Bean
    public DspCommandRunner dspCommandRunner() {
        return new DspCommandRunner();
    }

    @Configuration
    @MapperScan("com.fingard.dsp.core.dao")
    @ConditionalOnDatabaseEnable
    public static class DatabaseConfiguration {

    }


    public static void main(String[] args) throws Exception {
        String applicationName = "DSP-MANAGER";
        LunaBootApplication.run(applicationName, DspApplication.class, args);
    }
}
